// 用户管理相关接口
import request from '@/utils/request'

import type { IUserAssignData, IUserByRoleResponseData } from './type'
import type { ResponseData } from '@/types/common'

enum API {
  ROLE_BY_USER_URL = '/admin/acl/user/toAssign',
  USER_ASSIGN_URL = '/admin/acl/user/doAssignRole',
}

// 获取用户已分配角色接口
export const reqRoleByUser = (data: number) => {
  return request.get<any, IUserByRoleResponseData>(
    API.ROLE_BY_USER_URL + `/${data}`,
  )
}

// 用户分配角色接口
export const reqUserAssign = (data: IUserAssignData) => {
  return request.post<any, ResponseData>(API.USER_ASSIGN_URL, data)
}
